<%@ page import="com.zs.dao.AdminDao" %>
<%@ page import="java.util.List" %>
<%@ page import="com.zs.entity.Admin" %>
<%--
  Created by IntelliJ IDEA.
  User: chongge
  Date: 2024/1/11
  Time: 10:37
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/css/bootstrap.min.css">
    <script src="https://cdn.staticfile.org/jquery/3.2.1/jquery.min.js"></script>
    <script src="https://cdn.staticfile.org/popper.js/1.15.0/umd/popper.min.js"></script>
    <script src="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/js/bootstrap.min.js"></script>
</head>
<body>

<a href="adminAdd.jsp"><button class="btn btn-primary">添加管理员</button></a>
<div class="container">
<table width="100%"  class="table table-hover">
    <tr align="center">
        <th>编号</th>
        <th>姓名</th>
        <th>手机</th>
        <th>邮箱</th>
        <th>操作</th>
    </tr>
    <%
        AdminDao adminDao = new AdminDao();
        List<Admin> list = adminDao.getAllAdmin();
        for (int i =0;i<list.size();i++){
    %>
    <tr align="center">
        <td><%=list.get(i).getId()%></td>
        <td><%=list.get(i).getAname()%></td>
        <td><%=list.get(i).getPhone()%></td>
        <td><%=list.get(i).getEmail()%></td>
        <td>
<%--       ?id=<%=list.get(i).getId()%>把目标的id传递过去     --%>
            <a href="adminUpdate.jsp?id=<%=list.get(i).getId()%>"><button class="btn btn-dark">修改</button></a>
            <a href="adminDel.jsp?id=<%=list.get(i).getId()%>"><button class="btn btn-light">删除</button> </a>
        </td>
    </tr>
    <%
        }
    %>
</table>
</div>
</body>
</html>
